# -*- coding: utf-8 -*-

def frec(l1 , x , n):

	if not n:
		return l1
	else:
		return [x] + frec(l1, x, n-1)

l2 = frec([] , 'Bu', 5)

print l2

def fatorial (n):
        if n<= 0:
                return 1
        else:
                return n * fatorial(n-1)

def fatorial_cauda(n):
        def fact(i=n , acc=1):
                if i == 0:
                        return acc
                else:
                        return fact(i-1, (acc * i))
        return fact()

fatorial_cauda(5)
#***************************#
#Geradores, Iteradores
#***************************#
def gerar_cubos(N):
         for i in range(N):
                 yield i ** 3
gen = gerar_cubos(5)
print gen.next()
print gen.next()
print gen.next()
print gen.next()
print gen.next()

print
for y in gerar_cubos(5):
        
#***************************#
# SET , FROZENSET
#***************************#
lista1 = [1,2,3,2,4,5,4,5,5,1,3]
lista2 =  [x for x in set (lista1)]
print lista2

s1 = {'A','B','C','D','E'}
s2 = {'A','B'}
print s1 & s2, s1 ^ s2, s1 | s2
print s1 < s2, s1 - s2

print s1.union(s2), s1.intersection(s2)

                        


